package com.excilys.sae.entity;

import java.util.Date;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * 
 * Description of an user of secu-admin database.
 * 
 * @author yaziz, gferrand
 *
 */
public class UserDetails implements IUserDetails {

	private Long id;
	private String userName;
	private String lastName;
	private String firstName;
	private String phone;
	private String mobile;
	private String email1;
	private String email2;
	private String address;
	private String zipCode;
	private String city;
	private String keyActivation;
	private Date dateSubscription;
	private String schoolSubscription;
	private String promotionSubscription;
	private String companySubscription;
	private String fonctionSubscription;
	private Date dateOfBirth;
	private String language;

	private Integer quota;
	private AtomicInteger createdAccount;
	private String fullName;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getEmail1() {
		return email1;
	}

	public void setEmail1(String email1) {
		this.email1 = email1;
	}

	public String getEmail2() {
		return email2;
	}

	public void setEmail2(String email2) {
		this.email2 = email2;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getKeyActivation() {
		return keyActivation;
	}

	public void setKeyActivation(String keyActivation) {
		this.keyActivation = keyActivation;
	}

	public Date getDateSubscription() {
		return dateSubscription;
	}

	public void setDateSubscription(Date dateSubscription) {
		this.dateSubscription = dateSubscription;
	}

	public String getSchoolSubscription() {
		return schoolSubscription;
	}

	public void setSchoolSubscription(String schoolSubscription) {
		this.schoolSubscription = schoolSubscription;
	}

	public String getPromotionSubscription() {
		return promotionSubscription;
	}

	public void setPromotionSubscription(String promotionSubscription) {
		this.promotionSubscription = promotionSubscription;
	}

	public String getCompanySubscription() {
		return companySubscription;
	}

	public void setCompanySubscription(String companySubscription) {
		this.companySubscription = companySubscription;
	}

	public String getFonctionSubscription() {
		return fonctionSubscription;
	}

	public void setFonctionSubscription(String fonctionSubscription) {
		this.fonctionSubscription = fonctionSubscription;
	}

	public Date getDateOfBirth() {
		return dateOfBirth;
	}

	public void setDateOfBirth(Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}
	
	public String getLanguage() {
		return language;
	}
	
	public void setLanguage(String language) {
		this.language = language;
	}

	public Integer getQuota() {
		return quota;
	}

	public void setQuota(Integer quota) {
		this.quota = quota;
	}

	public AtomicInteger getCreatedAccount() {
		return createdAccount;
	}

	public void setCreatedAccount(AtomicInteger createdAccount) {
		this.createdAccount = createdAccount;
	}

	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	@Override
	public Locale locale() {
		
		if ("fr_FR".equals(language))
			return Locale.FRANCE;
		
		return Locale.US;
	}
}
